<?php

namespace EasyWaf;

class Waf
{
    /**
     * enable get parameter filtering
     * @var bool
     */
    protected $webScanGet = true;

    /**
     * enable post parameter filtering
     * @var bool
     */
    protected $webScanPost = true;

    /**
     * enable cookie parameter filtering
     * @var bool
     */
    protected $webScanCookie = true;

    /**
     * enable referer parameter filtering
     * @var bool
     */
    protected $webScanReferer = true;

    /**
     * enable userAgent parameter filtering
     * @var bool
     */
    protected $webScanUserAgent = true;

    /**
     * webScanWhiteDirectory
     * @var array
     */
    protected $webScanWhiteDirectory = [];

    /**
     * @return bool
     */
    public function isWebScanGet()
    {
        return $this->webScanGet;
    }

    /**
     * @param bool $webScanGet
     */
    public function setWebScanGet($webScanGet)
    {
        $this->webScanGet = $webScanGet;
    }

    /**
     * @return bool
     */
    public function isWebScanPost()
    {
        return $this->webScanPost;
    }

    /**
     * @param bool $webScanPost
     */
    public function setWebScanPost($webScanPost)
    {
        $this->webScanPost = $webScanPost;
    }

    /**
     * @return bool
     */
    public function isWebScanCookie()
    {
        return $this->webScanCookie;
    }

    /**
     * @param bool $webScanCookie
     */
    public function setWebScanCookie($webScanCookie)
    {
        $this->webScanCookie = $webScanCookie;
    }

    /**
     * @return bool
     */
    public function isWebScanReferer()
    {
        return $this->webScanReferer;
    }

    /**
     * @param bool $webScanReferer
     */
    public function setWebScanReferer($webScanReferer)
    {
        $this->webScanReferer = $webScanReferer;
    }

    /**
     * @return bool
     */
    public function isWebScanUserAgent()
    {
        return $this->webScanUserAgent;
    }

    /**
     * @param bool $webScanUserAgent
     */
    public function setWebScanUserAgent($webScanUserAgent)
    {
        $this->webScanUserAgent = $webScanUserAgent;
    }

    /**
     * getWebScanWhiteDirectory
     * @return array
     */
    public function getWebScanWhiteDirectory()
    {
        return $this->webScanWhiteDirectory;
    }

    /**
     * setWebScanWhiteDirectory
     * @param array $webScanWhiteDirectory
     */
    public function setWebScanWhiteDirectory($webScanWhiteDirectory)
    {
        $this->webScanWhiteDirectory = $webScanWhiteDirectory;
    }

    /**
     * run
     */
    public function run()
    {
        if (!Utils::isCli()) {
            $this->init();
            new Check();
        }
    }

    /**
     * init
     * @return void
     */
    private function init()
    {
        Config::set(Enums::OpenWebScanGet, $this->webScanGet);
        Config::set(Enums::OpenWebScanPost, $this->webScanPost);
        Config::set(Enums::OpenWebScanCookie, $this->webScanCookie);
        Config::set(Enums::OpenWebScanReferer, $this->webScanReferer);
        Config::set(Enums::OpenWebScanUserAgent, $this->webScanUserAgent);
        Config::set(Enums::WebScanWhiteDirectory, $this->webScanWhiteDirectory);
    }
}